/* 
 * File:   BlockingQueueObject.h
 * Author: lucia
 *
 * Created on 2 de noviembre de 2014, 16:03
 */

#ifndef BLOCKINGQUEUEOBJECT_H
#define	BLOCKINGQUEUEOBJECT_H

#include <queue>
#include <mutex>
#include <condition_variable>
#include "../Define/Structs.h"

using namespace std;
  
class BlockingQueueObject {
private:
    mutable std::mutex mtx;
    std::condition_variable cv;
    std::queue<struct ObjectInit> queue;
public:
    BlockingQueueObject();

    void push(struct ObjectInit data);
    
    struct ObjectInit waitAndPop();
    bool tryPop(struct ObjectInit &data);
    
    bool empty();
    int size();

    virtual ~BlockingQueueObject();

};

#endif	/* BLOCKINGQUEUEOBJECT_H */
